#ifndef DRAWWAVE_H
#define DRAWWAVE_H

#include <QWidget>
#include <QMouseEvent>
#include <QPainter>
#include <QPen>
#include <QString>
#include <QMessageBox>
#include <QFile>
#include <QFileDialog>
#include <QList>

#define DRAWAREA_OFFSET_X   20
#define DRAWAREA_OFFSET_Y   70
#define DRAWAREA_LEN        1024
#define DRAWAREA_WID        512

namespace Ui {
class drawWave;
}

class drawWave : public QWidget
{
    Q_OBJECT
    
public:
    explicit drawWave(QWidget *parent = 0);
    ~drawWave();

    QString filePath;

    void changeFilePath(QString &path);
    
private slots:

    void on_pushButton_clicked();

    void on_pushButton_drawWave_clicked();

    void on_pushButton_saveWave_clicked();

    void on_spinBox_resolution_valueChanged(int arg1);

    void on_spinBox_samplingPoints_valueChanged(int arg1);


    void on_pushButton_Browse_clicked();

private:
    Ui::drawWave *ui;

    void paintEvent(QPaintEvent *event);

    void mousePressEvent(QMouseEvent * event);
//    void mouseReleaseEvent(QMouseEvent *);
    void mouseMoveEvent(QMouseEvent *);

    void waveGenerate(void);
    void waveSave();

    bool drawingFlag;   //set to 1 when enable drawing wave function

//    int mouseX_Now,mouseY_Now;
//    int mouseX_Past,mouseY_Past;
//    int mouseX[500];
//    int mouseY[300];
    int mouseX_past;
    int mouseClickX;
    int mouseClickY;
    QVector<int>  mouseLoc;
    //int mouseLoc[DRAWAREA_LEN+1];
    QVector<int> datatoWrite;
    //int datatoWrite[DRAWAREA_LEN];
    QVector<int> wavePointsLoc;
    //QList<double> datatoGenerate;
    QVector<double> datatoGenerate;
    QVector<int> waveDisplayLoc;

    QVector<QLabel*>    axisLabelLocX;
    QVector<QLabel*>    axisLabelLocY;


    int waveResolution;
    int waveSamplingPoints;
    bool generateWaveDisplayFlag;
    int samplingPoints;

};

#endif // DRAWWAVE_H
